a possible solution for Ex4