Split queue length into two functions