Moved a bunch of stuff into lib folder.
Updated compilation scripts.