Bug fixes and clean up
4.0.0-beta