should I be declaring i at the top of my function?