merge changes from @davidw branch

merge changes from @dawidw branch