Fixes #71 - some crazy races inside erasure and simplify the code

- This change also brings in changing 'unsigned char' to 'uint8_t'
for brevity
Merge pull request #92 from harshavardhana/pr_out_fixes_71_some_crazy_races_inside_erasure_and_simplify_the_code