Updated State and UI classes to remove recursive nature.