refactor state handling
accept request type in command-line args; handle wrong request type propoerly