Finished refactoring settings. Fixed #40