ensured preferences are stored in a subdirectory

in the process, refactored directory handling