updated to allow independent specification of encoding parameters