Some helper code for homework4 and 100/100 project 4 implementation