optimizations, db file checking + Exception