Compelte the functionality of hw6