Assignment 2 solution by Marcus Drost