State management with user component, not global functions anymore