Added assert and test functions