Added x button functionality