simplify code a bit
note about connection errors, retries, race conditions, potential abuse