Refactor frame API