fix bugs, start work on states