Improved previous commit and some cleanup.