Refactor  accorging to codeclimate