-added onBeforeExpiry callback