moved to function and changed to equals()