move lb logic from cmd to engine pkg