fixed block reflection
rewrite AI functions