merge squash of previous efforts

mostly from jsiochi