Added file checking to the main class