added initialization of variable result