encapsulate script in html class
wrap prefix in its own case class
use implicit definition of idPrefix
reduce method copies by using implicits and moving to Ids classes
add traits HasOptions and HasHtml
whitespace
use TreeState trait
remove unused traits Entry, StackEntry, move elementNumbers to TreeState trait
remove unnecessary methods
move element numbers map creation to trait TreeState
don't use wildcard case match for Option or sealed traits