cleanup and minor improvements