Refactorisation 2, state pattern