Sharing code between views

Using CommonJS modules to re-use code in view functions