add a todo fixed bug
optimization: seperate the main operation