somewhat more cleaned up, but need to fix that repition bug and the tessel count looks wrong