adds debug mode, cleans up AI