Refactoring code to conform to Ruby-Style guide