added condition to not rander an 'p' tag if is not necessary