Refactor settings.cpp implementation