Fix config & use closure to maintain state