states logic

initial arch and some test