Complete rewrite: now uses 4 port R as basis