fixed global to local (done now) and fully connected with GUI