Rebased the content of the branch nicholas-leonard:master into Theano:master