correct Result Observation templateId and some code cleaning