refactor typing