clean up and minor improvements