added more intelligent fox code