Fix style and API problems