implementation of Plastic Trees paper