Corrected empty message issue and also added comments