Adding a bunch of stuff from Velo's pull request.