Reorganize the code.
Add easy to use main program.