added file checking, couts and fixed filepath