Code for part b of the assignment. Also added necessary utility function files