Some server stuff and separated client code