Refactor settings module