AI Code Mark V

The problems should be fixed now. It's not smart yet but it works.