re-construct code