Implemented basic state machine along with main-test program (nested states still needs to be figured out)