taking care of encoding