fixed #33 and some ai stuff!