Add in tests, plus config options and minior changes