Undo last commit and apply some function compacting