Implements assignment 3