code for CSCI 580 project