changed increment to ++