Updated functions for gui