Simplified the main function, just need to convert 'counter' to string (to_string() won't work)