Adding 7
Adding profiling and removed unnecessary prints
Made the algorithm simpler