Cleanup and a some fixes