Working on Fixing algorithm and rules

Signed-off-by: fisherjk <John@John-PC>