added legend and some other gui elements