cleanup: moved brackets, whitespace and unused code removed
added list to keep track of pending requests. add id to list when request sent, remove from list when response received: