Filemanager now working properly

...n, general code tidy