Cleaning up the code by removing a giant match tree and other small things

These are small  improvements that were mentioned in #13