cleaned up and abstracted @fchasen additions.