fixes and out.txt is output, CountCard method added