CS 221: Completed assignment 5 #2b