Fixed bugs in evaluation functions and made a few more efficient