Refactored web server and tests