updated with gui implementation