added struct and function