Clock stuff from here, changed for us a95645e04e1f968347dca11e7a0f131cba079f9d