equals function and some tests