assignment 4: finished encode, on to the rest