Ex 7 refactored