finalize implementation