Code I wrote to deal with the agony that is Comp3600