added some comments
fixed wrong return type for safe average_dib
parameterized the test program. now you can supply a table size.