added tag and encoding functions