from functional to imperative structures for storing the result