MSDP fixes. Still ugly code :(