coded ai, fixed up bugs, cleaned up code a bit