cleaned up the code, modernized some iterators, added some generics, fixed a bug that caused an exception when printing an empty method body