refactor console