more work and bug fixes