Added path zero padding so it's safe to use with hours, days, etc.
Moved most function definitions to lib.py