move figure stuff to its own package