Clean up code in views