work and refactoring on server api
adding some basic tests