Make Code Climate happy

Remove duplicate and complex code without affecting functionality.