ported sorting onto new table
ported adding of epochs
ported collapsing of a level