modified this to use top instead