First attempt at refactoring the working state