Lots of changes and cleanup.