got most of API working