legend is optional, updated TODO