re-remove old way of handling attachments; use longest function instead of builtin max function
initialize attachments var; use a working longest function
remove 'longest' import