created confirm function for more flexibility