added several methods to lambda, implemented applyProduction and improved production rules