utils improvements, changes to scanner