Implement garbage collection and improve log categories