Completed main server script and wrote the router