changing to L_c
added thinning function