Updated the code to match recent updates to the master branch