cleanedup stat.c