more refactoring

the backend system is now nearly finished, though still untested