added functionality to the finalize button