Clean up old code and some minor corrections.