Code styles and duplicates refactoring