refactor HAL as static functions