Move static functions further up so they are delared efore being used.