a bit of refactoring, getting ready for 3d