fixed message splitting, added some comments