Added Ex-4. Tasks 1,2,3 are implemented.