fixed a few bugs and expanded attach algo