Refactor leaveafter logic.  This better suits querying local storage for leaveafter count.