Final Version Stateful