Implemented shared state, not tested