tweaked so it works on the espruino