Working Algo ( some points to fix)