Updated Mallet Code