more elegant loops