More refactoring to modularize bot, fix local-smashing strcpy.
Fix Windows Line Endings due to editing over SFTP/SSH.