Refactoring airconditioner code