Simplify add attachment logic a little