Added queue tests. Better error handling in KM.