Bug fix and cleanup