Removed unused imports.
I found out that our tool doesn't complain if we try access identifiers that has no declarations,
it just produces a NullPointerException. So I patched up the codebase to throw an exception instead.
Preliminary bound checking.