updated professor's code