updating to work with the latest

and made it a run-able function