fixing bugs and updating to match api