Correct multi-target behaviour and other fixes per Hanna's requirements.