Fix bug from last commit: missing import datetime
New logic for checking retraing queue
Update start and stop script