Bug fixes. Cleanup.