Renamed some variables for clarity. Fixed processing of smtp-id.