Cleaned up State a bit.
And made State work correctly in the main file.