code need to be cleaned up and refactored ; make it statsd-independant