added multiple instance support