Implemented decode, encode and quickEncode methods.