Move code into a lib.
1-2 Completed.