first version, tested on breadboard with notes