implementing convert method instead of double encoding