added concept of state design pattern.