clean up and minor fixes