rect tool refactor