Fixes bug on refresh after saving note

Generic loop counters ran into name conflicts between functions
Refactored them into more meaningful names to avoid clashes