Refactors good amount of repeated code into controller/view chunks (without file separation though) as well as pulling out some functions into external files that are included.