working rule engine...kinda