A simple tree algorithm with traverse capabilites