Introduction of a non-sinusoidal deformation can enhance the efficacy of modular coils for generating magnetic fields with a built-in rotational transform. Techniques are developed that provide an understanding of how specific deformations affect the harmonic content of the magnetic field and thus the properties of the vacuum configuration. A procedure is provided for optimizing a modular-coil configuration with respect to the equivalent current, which provides a useful measure of the product of the rotational transform and the cross-sectional area. Application is made to systems with ℓ = 2. It is shown that the configuration properties can be enhanced by introducing a modulation of the curve defining the centres of the coils or by having an additional elliptical shaping of the coils.