refactoring encode/decode interfaces...