making tree builder more extensible