Mostly working, few bugs, moving on to unit tests.