Clean up and minor bug fixes.