got working Either for slope function