nosql_dir refactored