cleaned up view logic