Update main.cpp

re-did/moved the eval function for efficiency