core fixes;StateManagment decoupled from the rest of the core