added attachment handling