Move more code into the framework