Refactor code. GBM works