fixed cukes nd done some refactrng