Reefactoring and fixing