Refactor public api