Law start-up survives near-death experience to build $31m company