minor optimization no extra memory needed