unified use of RestClient to help with features like issue #15 and to improve the modularity of the code