Refactor for Codeclimate