clean up the code in the views