Move constants and shared code for tools to a separate module
Add sanity checks for splitting