refactor code - add templates for library page and for current page attachments