added the function and more of the story