More bug fixes, added plots legend