Bug fixes, removed unnecessary imports, and clean-up