solution 3 properly works