Implemented state design pattern