Added support for Mmsapt.
Bug fixes. Added some sanity checks.
Minor edit of a comment.
Bug fix.