Patched for reference from gui