implemented steps 3-10