changed once again the attachment test, reorganized the code a little