Refactoring, fixing, cleaning and commenting