Refactor frame API
wip