Added code for ex6