Various modifications and clean up.