Refactored and added settings file support.