WIP: refactor preferences logic