refactor spacemaster to class