Modify state managment

don't keep useless data.
clear comments.