improving prog tree structure