Add state class

#99 #101 #102 #13 #14 #27