optimizing filldb.py file