Added a new API /event/finalize and the related functions