many changes after understanding the structs and related types