Created tool.py
Added tools.py and moved tools code there.
Added validate function
Validator minor changes