Refactor application code into controller layer.