Second commit, 3 state system implemented