readded onclick and better debug alerts