Reuse of "ship" as a variable name threw me for a moment. I suggest renaming it.