original code Noah sent me
added code to execute the function to the bottom
added clariyfing comment to bottom