added encoding helper