Added some comments.
Implemented MAC and integrity check.