Creates classes instead of using gross data structures

Makes the constructor of Test a lot cleaner, fixes bug with arity checking.