Added alternative to apply_rule, using indexing and operator overloading (and modifying a function body) not sure if this is the right way to go.