Removed unneeded imports and a few rewrites