Moved ext array to global var
Added file ext check