move view functions to separate file