Updated API and made everything c90 compliant. Removed unnecessary code.