attachments and more refactoring
test fix