Makes error logger more robust and improves db stuff