more fixes and cleanup, should be ready for basic testing