Move shared client library to top level

Closes #71

Also tightened up the CORS library writer code a bit