Updated two errors. Global variable undeclared and depreciated function.