Some cleanup in API