Refactor to common api