CS 221: Completed assignment 5 #3a