Moving most of the code out into a separate module that can be accessed from different input interfaces. This will allow the module to be used to compile an ASP.net web service.