Copied from the Pebble SDK since the official github repo for Pebble is old