Added part A of assignment, tested successfully