Finished controller code and tests.