Cleaned up warnings and used new api.