cleanup, tests, fixes