only last y-coord needed to be set outside of loop