Some changes to ai, and added unit struct