added attachHandler method