Improved code: fixed usage of raw types (except Commons Collections) and converted use of Iterator to for-each loop