Refactor layout for classes