extract more binary file logic to app