We present a new version of the GALFORM semi-analytical model of galaxy formation. This brings together several previous developments of GALFORM into a single unified model, including a different initial mass function (IMF) in quiescent star formation and in starbursts, feedback from active galactic nuclei suppressing gas cooling in massive haloes, and a new empirical star formation law in galaxy discs based on their molecular gas content. In addition, we have updated the cosmology, introduced a more accurate treatment of dynamical friction acting on satellite galaxies, and updated the stellar population model. The new model is able to simultaneously explain both the observed evolution of the K-band luminosity function and stellar mass function, and the number counts and redshift distribution of sub-mm galaxies selected at 850 μm. This was not previously achieved by a single physical model within the Λcold dark matter framework, but requires having an IMF in starbursts that is somewhat top-heavy. The new model is tested against a wide variety of observational data covering wavelengths from the far-UV to sub-mm, and redshifts from z = 0 to 6, and is found to be generally successful. These observations include the optical and near-infrared (IR) luminosity functions, H I mass function, fraction of early type galaxies, Tully-Fisher, metallicity-luminosity and size-luminosity relations at z = 0, as well as far-IR number counts, and far-UV luminosity functions at z ˜ 3-6. Discrepancies are, however, found in galaxy sizes and metallicities at low luminosities, and in the abundance of low-mass galaxies at high-z, suggesting the need for a more sophisticated model of supernova feedback.