Changed message header handling, added features, and bug fixes