avoid compile warning message
linear search to binary search
changed moment of cfg printout, better pretty printing