Refactored some things a little
Bug with settings fixed