split up view function