Refactored API to always return int and moved a few result values into params with ptrs