Add type annotations to avoid reflection