Moved call to lower() outside of loop.