Better way to determine the root dir