Updated controller, now with tests.