Refactor dynamic tools

fixes #671