Backported quamilek changes from master into prez.