Improved state pattern, more understandable