FreeAttach improvements + code cleanup