Cleanup: Remove unused static functions, add compile flag to check