Cleaned up Pebble code