modified distribution.c