Refactoring and updating code style