minor cleanup and purification