Code for CSC 171