Move shared code into static library