refactoring api apparently finished
bug fixed