I've written in more of a structure for main, which will be the smoother function.  I have also made skeltons for the indexing functions.