same functionality but simplified code and more robust balance checking and server access