cleanup and minor fixes