separated chk_row and chk_cap into separate files