Change API to use BurntSushi xgb and include more error checking