Modified asm.py to use a global search function, instead of duplicate code