Cleaning up code further (especially in the view script files