rewrited debug, fixed clear, new dir hierarchy, added state and some other classes