struct code, add init func