added support for more types while encoding