Clear build.sbt
Add Term class
FSMize state. Improve RPC processing