Added code for ex3