reworked functions in GUI js