move view-related stuff into a separate file