oops.
modifying code to use better functions