#28: finished implementation and added most of the unit tests, which have not yet been run