ex 4 with tests