Better file logic