Moved program state to helper structure, argument parsing handled there.