made view changes, refactoring code to be cleaner