cleaned up accessing of preferences