State manager and some state testing