Adding API-level code (work in progress)