update statistics block and move functions to api