Understanding and implementing regression trees