removed unnecessary count checks and added some linq in kinectcontext