fixed code climate issues

type safe equals, logging extracted