more refactoring, adding plane functionality