Added a bit more logic, included Util from WarDance