added averaging of orientation and position