created working example, and tweeked gdb code