added some error-proofing code, did not test it yet, need Kinect