steps 1-3 done, needs debugging