Improvements in RebaseHandler. Code cleanup