added refernce code from peterc's turtle implementation, now need to make it work