Shouldn't these two be out of the if / else block? It seems that as it stands, those variables won't be set in the else case