Get rid of a lot of redundant code, using streams everywhere and generally improving code, performance and clarity
6