Cleaned up logic when message exceeds max length

There were a few small bugs that prevented this from working properly.
Also removed duplicate send message code that was brought in by a merge.