Refined rules engine for conditions, starting adding state routines