Integrates some stuff from the google implementation