adding changes from Patrick