added onclicks and socket listener for clicks