Code for COSC 494/557