General update to "tools". Reorganizing the code.