server api added, refactoring