Add table information querying
Format logger
Only change tables where necessary