Using struct and passing function