added state management functions.