Reorganized things and set up a shared library.