Cleaning up the code by removing a giant match tree and other small improvements that were mentioned in #13