fixed error handling
timedelta.seconds bug fixed
Handling empty db case
enum and other simplification