Refactor signature verification to avoid global

Don't really need entire $GATEWAY array sucked in to the function when I
only want one thing from it.