most work done, needs debugging