Finalizing logic and removing warnings