updated per brian's suggestions