Added default settings, commented code, tidied up