Replaced NULL with nullptr and added comments.