added encode&decode