reimplementation of polvi/simple-amb