add main(), command-line arguments to control input etc., logging, and more error handling; also put in some basic verbose logging steps (not really needed, but fun)