my implementation of http://dixq.net/rp/