Code cleanup and testing video cap