Counting and syncing files now separated. Still a mess. But functional.