Move all the recording stuff to a different (reusable) class.

This cleans up the view controller's implementation by a large margin, and brings the code more in line with the OOP/MVC model.