Trying to implement max