added encoding option