worked on the UI toggle logic