Mostly working simulation of p5a