Moved initial state generating code to an initHelper to allow other
tests to recycle the code