File manager moved to templates, overhauled code