There is a lot of cruft in this code that is not required for the job it is now performing.  Prior to merge that will all need to be chopped.