added current and previous state functionality along with tests