Added function to hide fields if they are empty