current in song... JmbSlot Song::scroll_right(JmbMessage* m) { PENTER3; firstBlock += scrollAmount * Peak::zoomStep[hzoom]; scrollAmount = 20; mta->recreate(); //Set the scrollAmount back to some sane value in case this PEXIT3; //slot is called directly instead from jog_scroll, or another method wants using it return (MustuxAction*) 0; } JmbSlot Song::scroll_left(JmbMessage* m) { PENTER3; firstBlock -= scrollAmount*Peak::zoomStep[hzoom]; if (firstBlock<0) firstBlock=0; scrollAmount = 20; mta->recreate(); //Set the scrollAmount back to some sane value in case this PEXIT3; //slot is called directly instead from jog_scroll, or another method wants using it return (MustuxAction*) 0; } --- it will become more or less JmbSlot Song::scroll_right(JmbMessage* m) { PENTER3; MustuxAction* a = new MustuxScrollAction(); a->setDirection(RIGHT); a->do(); PEXIT3; return a; } JmbSlot Song::scroll_left(JmbMessage* m) { PENTER3; MustuxAction* a = new MustuxScrollAction(); a->setDirection(LEFT); a->do(); PEXIT3; return a; } and class MustuxScrollAction : public MustuxAction { public : static const int scrollAmount = 20; void do() { originalPos = firstBlock; if (direction==LEFT) { firstBlock -= scrollAmount*Peak::zoomStep[hzoom]; if (firstBlock<0) firstBlock=0; } else firstBlock += scrollAmount * Peak::zoomStep[hzoom]; mta->recreate(); } void undo(); { firstBlock = originalPos; mta->recreate(); }~ void setDirection(int direction) { this->direction = direction } private : int direction; } isnt it beautifull ?? no duplication, but completely reorganization of the code...