debugged newclick function