abstracting views to work on the server and client