If and elses added for empty values