Added State class to implement states according to state pattern