Resolve stackOverFlow issue. Use foldLeft instead of reccursively call accumBoosting.