Refactor main export script, add dependency find