logic improve of variable (NP - number of waterlines) declaration