Checking variable before adding or updating
Optimized logs