updated code to pass all test