more api work done, nearly finished