Factored out else if statement, moved var path declaration higher in scope to allow for that