error detection - fill in ASSERT, move asserts to begin