Based on https://github.com/gilbitron/Pico