Modified version to work with CloudPebble.