add tests and fix ugly default setup code