Adding API code