move navigation out of if