  We investigate a new implementation of the Smoothed Particle Hydrodynamics
technique (SPH) designed to improve the realism with which galaxy formation can
be simulated. In situations where cooling leads to the coexistence of phases of
very different density and temperature, our method substantially reduces
artificial overcooling near phase boundaries, prevents the exclusion of hot gas
from the vicinity of cold ``clouds'', and allows relative motion of the two
phases at each point. We demonstrate the numerical stability of our scheme in
the presence of extremely steep density and temperature gradients, as well as
in strong accretion shocks and cooling flows. In addition, we present new
implementations of star formation and feedback which simulate the effect of
energy injection into multiphase gas more successfully than previous schemes.
Our feedback recipes deposit thermal energy separately in cold dense gas and
hot diffuse gas, and can explicitly reinject cold gas into the hot phase. They
make it possible to damp star formation effectively, to reheat cold gas, and to
drive outflows into the galaxy halo and beyond. We show feedback effects to be
strongest in small mass objects where much of the gas can be expelled. After
idealised tests, we carry out a first low resolution study of galaxy formation
in a $\Lambda$CDM universe. Feedback results in substantial and mass-dependent
reductions in the total baryonic mass gathered onto the final object as well as
in significant modulation of the star formation history.
