New implementation

Re-engineered from the ground up.