Modified to use Python main, separating file checking.