adding preprocess function to provide additional variables for the templates, and adjusting view and templates