move asserts in own functions, it's more readable that way