Error handling change
Added api test script
Fixed an unstoppable wave of bugs