Server improvements + tests