Created State Pattern for ui