Cleaned up code for views