Refactored clean views code