Added file transfer progress bar and cleaned up malloc for lower memory consumption