use call back to send rules

almost done