Refactors BTBuilder. Fixed multiple layer tree handling.