updated when_tapped and some code