added configurable encoding