Refactored some code. Started on JESS implementation.