Cleaned API code