Updated variable increment logic