cleaned up view code