merged Peter's messed up code
Merge origin/master