Passes all tests but need to optimize
Fixed merge conflict