Working version with GUI