Finalised a fully working version of the settings handler.