Partly implemented solution 2.