Fix start script
Refactor and fix to process directories and image files separately for clarity