Cleanup of imports and fixed a resource leak in Scanner.