Updated to fix blank file problem