better implementation of eval