Clean up and comply to new api.