Update tool.py: reorganized code

Signed-off-by: Michael LeCompte <michaelslec98@gmail.com>
Update list.py: add safeguards

Signed-off-by: Michael LeCompte <michaelslec98@gmail.com>