solved function