Integrated @cnbates19's code with 'the structure'...by adopting his structure