Working version of argmax

gave up on parallelizing