Ported latest master from Google Code