Re-organized source tree to use as a library