Updated view templates and document click handler