I haven’t looked at your code but your description sounds similar to this thread last week:
It does not have to be pointed at the top like this: