code refactoring to make codeclimate happier