broke the huge encodeinterface__ function up into chunks by templating specialized encoding functions for each slice and map type