Code cleanup and minor bug fixes