Tweaked script for devices without find