Refactor controller system. Reduce duplicate code in human controller and ai controller