Add generics to fix casting problem.
Make exception catching more concise.
Remove unused imports.
Merge branch 'master' into refactor/generics

This incorporates the for loop refactor.
Introduce several "for each" loops to reduce clutter.
Merge pull request #37 from agouge/refactor/generics-and-for-each

More code cleanup
Fix failing build due to upstream changes.
Merge pull request #38 from agouge/fix/upstream-changes

Quick Fix (one line)