initialize and finalize