Clean up and small bug  fixes