All sorts of changes - much slightly hacked