pseudo code for 3 and 4 -- very pseudo code