Add handling for database disconnects
Add pagination to thread page