Using softmax and fixing minor bugs