restructure function partially updated