Introduce new state system by Alex, add some test