added state handling support