Re factoring code for redundant unnecessary check while checking equals
re factoring the equals method

Now using instance of operator rather than a null and a class check