Some  fixes and cleaning up