Replaced system() calls with direct file system manipulation in Perl. Much faster and cleaner.