a little more commenting, failsafing (not done yet), etc