Code for 1-3 done