Refactored tempController