Refactoring to modern style