moving sme code around to support the next plugin