code from CSCE 221