Not my code, clone from http://resnet.uoregon.edu/~gurney_j/jmpc/fib.html