Change to check maxBy multiple possible ways.
Some refactor. Delete recursive function.