This code seems to work after light testing

Have filled out the framework with working code.