Full rewrite using PebbleJS