Setting up a more flexible context to finish the encoding code