jh - merging AI code