Added Validations and Comments

Added Validations for required fields.
Added Comments for better understanding of code