finally got the correct answer