change numberOfRows to local variable