refactor
implement thinking