Separate UI from API code