Added mah_eencode for encoding template tags