Corrected customize script to search depth first