code restructure, restartCameraCapture(), bug's fix