Various gmail stuff

Please carefully review each change if you want to include it.