Finished refactoring with map, reduce, filter
Re-wrote all functions with lambdas