Some indentations would make this more readable. Also, document the keys for the config parameter.