added jan's solution