master

This is a wrap up to version 4.0 to master.