fixed some more issues around restricting accees to authorized users. also pulled out all refactoring for old database versions and fixed an error during import.