Fixed a few bugs and made the evaluation function better.