Add better logging and stats tracking.