working on generateAttach( not done yet)