Added a command line switch to specify a state directory