added statecommand, simple tests