added own eval and refactored code