Assignment 6 implementation