adapted TreeBrick code to new SC