Added file checking