refactor slightly, only pull state bids
add proper exit codes