A polynomial time algorithm for constructing the refined Buneman tree