Merged changes from Jake Biesinger and mercurial branch