Simplify networks logic and add a few comments