NEW: implementation of State design pattern