New Scan Logic

Updated the way the  scanner works to avoid conflicts with older PHP
versions