refactor settings loading