Move source into dirs and move reusable stuff into a lib.