just needs debugging