Updated attachment handling