Improved state manager