refactor
works now
with gui and warning