fixec confirm function bugs, reworked logic and added more tests