clean up code a bit more - remove a continue and unnecessary index reset