Complete rewrite from scratch!