make it work with gui