Improved modularity and flexibility of code

Less hard-coding, rewrote code so code can be used in a modular way to
suit different taxonomic needs