changed back from attaching to onload