Code made more efficient