tool functions