Adds API Test function and corrects magic call issues.