Fixed crash. Added some comments.