ATTACHMENT -> ATTACHMENT_MODE, avoid using _id
general cleanup
updated jIO