code consolidated