Function cleanup

I was skimming the code (I am at NSLS-II and will probably be working on XRF fitting in the near future) and came across the `addbackground` method which had an undefined variable so I fixed it.

I also modernized the function above it (`addtheory`) and updated the test which used `addtheory` to verify that it still worked.  The documentation on `addtheory` needs to be updated as there were two extra parameters in the code which were not documented.

After I had done this I checked if the functions were used any where (they don't seem to be) and then noticed they were both last touched in a meaning full way in 2006 (!), so this may be a irrelevant PR, but I have already done the work.  I have no problem if you want to ignore this.