Master copy of prototype, needs debugging