created separate methods and fixed check file