setting width for centered container by passing parameter; optimisation