Refactoring, fixing code style