Refactor buildings controller