Rewrote cosine.
Made minor changes to evaluator.