implemented new version of finish()