improved DRYness; misc updates and fixes