much more reasonable AI
proper debug
more debug and some error handling