Fixed a bug and removed some unused imports