Optimize the areas where its creating extra memory