updating initialize_state to take an instantiated factory
changed initialize_state to a boolean function
removing non-standard error code