Refactored the config array, tidied up a few bits