improve algo
able to save user setting now