Finish functions. Better file detection.