Updating for 4.1 

Updating for 4.1 - most of the changes from Ian Duffy.