Formatting summary
Changed grep in if conditions
Refactored dbWriteTable