Changed a few function names and made AI more dynamic