attempted to write some AI; need to review it...