I can't try right now, but I am fairly certain that your first few if statements could be substituted by
only this would be muuuuch faster, that should explain why your way 1 is so slow.
Of course we don't know what Routing3a does, so hard to help you if there's an error in there.
And lastly, it appears to me that
is nothing but
so what is that line supposed to be doing?