refactored row_checking and general syntax