improve code with do expression