add structure function code