Modularized the code a bunch

Removed a lot of duplicated code and subroutines.
Added ability for cross and inline.
Removed welhofer specific stuff. Now this needs to be added to
spreadsheet.