moved to a more generic eval loop