Fixes and cleanup

Fixes and cleanup