finalizing code