Add argmax and other supporting things