Fixes and cleanup, almost ready for beta 1