Fixed the calculateAttract method