moved keyword limit outside of loop