added first version of rule parsing