Moved finalized function to codes from tests
first commit of the pdf version