remove onreadystatechange callback; some improvements