Refactored some code climat problems