finished main algorythm which chooses type of block
make cqbuff as local variable, and now cqdict is variable in struct
fix some bugs
make cqbuff as local var
add new funciton - write to output