modified to use structure