Move the code to a more specific controller and html module. There's a lot of code related to the revision pages, and having it separated will help with refactoring it.