Added option rewrite and value evaluation and added tests