clean up and a few fixes