Refactored some view related stuff