sync from master

first time doing this. there is probably a more elegant way.